﻿using System;
using System.Collections.Generic;
using ScrumTable.Common.Collections;

namespace ScrumTable.DL.Data.Common
{
    /// <summary>
    /// Provides the signature of a function pointer which is used to
    /// notify the observer about a data update begin event.
    /// </summary>
    public delegate void UpdateBeginEventHandler(object sender, EventArgs args);

    /// <summary>
    /// Provides the signature of a function pointer which is used to
    /// notify the observer about a data update end event.
    /// </summary>
    public delegate void UpdateEndEventHandler(object sender, UpdateEndEventArgs args);


    /// <summary>
    /// This class provides data required for the business layer
    /// in order to report data update (sychronization) errors.
    /// </summary>
    public class UpdateEndEventArgs : EventArgs
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Provides a list with synchronization errors.
        /// </summary>
        public IList<IDataSyncError> Errors { get; private set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new UpdateEndEventArgs instance with the specified data.
        /// </summary>
        public UpdateEndEventArgs(IList<IDataSyncError> errors)
        {
            Errors = new ReadOnlyList<IDataSyncError>(errors ?? new IDataSyncError[0]);
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        #endregion
    }
}